#!/bin/sh
# Relaunch shim for the Electron Hub's Squirrel.Mac update onto this bundle
# (HUB-8041). Staged by scripts/bundle-macos.sh at
# Contents/Frameworks/Squirrel.framework/Resources/ShipIt.
#
# On macOS 11+, the OLD app's ShipIt relaunches by spawning its own argv[0] as
# `ShipIt ___launch___ <bundle path>`. By then that path points into the bundle
# it just installed, which is this one. Without this file the spawn fails with
# ENOENT and the Hub never comes back. Only the launch request is handled;
# install requests never reach a native bundle.
if [ "$1" = "___launch___" ] && [ -n "$2" ]; then
  exec /usr/bin/open "$2"
fi
exit 1
